package io.renren.modules.generator.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.generator.entity.SysLvExpEntity;
import io.renren.modules.generator.service.SysLvExpService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2018-11-21 10:57:32
 */
@RestController
@RequestMapping("generator/syslvexp")
public class SysLvExpController {
    @Autowired
    private SysLvExpService sysLvExpService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:syslvexp:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysLvExpService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{lv}")
    @RequiresPermissions("generator:syslvexp:info")
    public R info(@PathVariable("lv") Integer lv){
			SysLvExpEntity sysLvExp = sysLvExpService.selectById(lv);

        return R.ok().put("sysLvExp", sysLvExp);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:syslvexp:save")
    public R save(@RequestBody SysLvExpEntity sysLvExp){
			sysLvExpService.insert(sysLvExp);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:syslvexp:update")
    public R update(@RequestBody SysLvExpEntity sysLvExp){
			sysLvExpService.updateById(sysLvExp);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:syslvexp:delete")
    public R delete(@RequestBody Integer[] lvs){
			sysLvExpService.deleteBatchIds(Arrays.asList(lvs));

        return R.ok();
    }

}
